Page({
  data:{
    list: [
      
      {alphabet: 'A', datas: [
        {"cname":"乔纳森1","jobTitle":"设计总监","compName":"上海立信汇文企业服务有限公司","opid":"1abcdefghijklmn"},
        {"cname":"乔纳森2","jobTitle":"设计总监","compName":"上海立信汇文企业服务有限公司","opid":"2abcdefghijklmn"},
        {"cname":"乔纳森3","jobTitle":"设计总监","compName":"上海立信汇文企业服务有限公司","opid":"3abcdefghijklmn"},
        {"cname":"乔纳森4","jobTitle":"设计总监","compName":"上海立信汇文企业服务有限公司","opid":"4abcdefghijklmn"}
       ]},
      {alphabet: 'B', datas: [
        {"cname":"乔纳森5","jobTitle":"设计总监","compName":"上海立信汇文企业服务有限公司","opid":"5abcdefghijklmn"},
        {"cname":"乔纳森6","jobTitle":"设计总监","compName":"上海立信汇文企业服务有限公司","opid":"6abcdefghijklmn"},
        {"cname":"乔纳森7","jobTitle":"设计总监","compName":"上海立信汇文企业服务有限公司","opid":"7abcdefghijklmn"},
        {"cname":"乔纳森8","jobTitle":"设计总监","compName":"上海立信汇文企业服务有限公司","opid":"8abcdefghijklmn"}
       ]}
      
    ],
    alpha: '',
    windowHeight: ''
  },

  click_handler:function(event){
    console.log("click_handler")
    var _opid = event.target.dataset.opid
    wx.navigateTo({
      url: '../scCard/scCard?opid='+ _opid,
      success: function(res){
        // success
        console.log(_opid)
      },
      fail: function() {
        // fail
        console.log(_opid)
      },
      complete: function() {
        // complete
      }
    })
  },
  onLoad(options){
    try {
      var res = wx.getSystemInfoSync()
      this.pixelRatio = res.pixelRatio;
      // this.apHeight = 32 / this.pixelRatio;
      // this.offsetTop = 160 / this.pixelRatio;
      this.apHeight = 16;
      this.offsetTop = 80;
      this.setData({windowHeight: res.windowHeight + 'px'})
    } catch (e) {
      
    }
  },
  handlerAlphaTap(e) {
    let {ap} = e.target.dataset;
    this.setData({alpha: ap});
  },
  handlerMove(e) {
    let {list} = this.data;
    let moveY = e.touches[0].clientY;
    let rY = moveY - this.offsetTop;
    if(rY >= 0) {
      let index = Math.ceil((rY - this.apHeight)/ this.apHeight);
      if(0 <= index < list.length) {
        let nonwAp = list[index];
        nonwAp && this.setData({alpha: nonwAp.alphabet});
      } 
    }
  }
})